package com.central.consume.model;

import com.alibaba.fastjson.JSONObject;
import lombok.Data;

import java.util.Date;

@Data
public class RechargeDetailsVO {
    /**
     * 玩家ID
     */
    private Long playerId;
    /**
     * 订单号
     */
    private String orderId;
    /**
     * 充值金额
     */
    private Double money;
    /**
     * 订单创建时间
     */
    private Date createTime;
    /**
     * 奖励1
     */
    private JSONObject rewardOne;
    /**
     * 奖励2
     */
    private JSONObject rewardTwo;
    private final static String PROP = "prop";
    private final static String BOX_KEY = "boxKey";

    public RechargeDetailsVO(ChargeLogDO chargeLogDO) {
        this.playerId = chargeLogDO.getTarget();
        this.orderId = chargeLogDO.getOrderId();
        this.money = chargeLogDO.getMoney();
        this.createTime = chargeLogDO.getCreatedAt();
        if (chargeLogDO.getReward().containsKey(PROP)){
            this.rewardOne = (JSONObject) chargeLogDO.getReward().get(PROP);
        }
        if (chargeLogDO.getReward().containsKey(BOX_KEY)){
            this.rewardTwo = (JSONObject) chargeLogDO.getReward().get(BOX_KEY);
        }
    }
}
